import { timestampToTime } from "@/utils";

export default {
  data() {
    const date = new Date().getTime();
    return {
      weekList: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
      image: require("@/assets/images/javascript-dosomething.jpg"),
      form: {},
      dialogVisible: false,
      pickerOptions: {
        disabledDate: (time) => {
          return date - 1000 * 60 * 60 * 24 >= time.getTime();
        },
      },
      nowDate: timestampToTime(),
      isEdit: false,
    };
  },
  computed: {
    //timedat参数格式： "2017-10-27"
    getWeek: () => {
      return function (timedat) {
        const date = new Date(timedat);
        return this.weekList[date.getDay()];
      };
    },
    // 是今天吗？
    isNowDate: () => {
      return function (date) {
        return this.nowDate === date;
      };
    },
  },
};
